Walk the whole shortcuts model, not just the bookmarks part --- there is
authorFederico Mena Quintero <federico@ximian.com>
Mon, 13 Oct 2003 19:59:37 +0000 (19:59 +0000)
committerFederico Mena Quintero <federico@src.gnome.org>
Mon, 13 Oct 2003 19:59:37 +0000 (19:59 +0000)
2003-10-13  Federico Mena Quintero  <federico@ximian.com>

* gtkfilechooserimpldefault.c (check_bookmarks_sensitivity): Walk
the whole shortcuts model, not just the bookmarks part --- there
is no need to add bookmarks for "stock" volume items.
(gtk_file_chooser_impl_default_set_property): Oops, hide/show the
tree/list as appropriate for the folder_mode property.

gtk/gtkfilechooserdefault.c

index 2de5855b961ef395b1210b30b80e22ec3797b374..ad963c167df101c463a5bbb2528a80e6b2ed0e8f 100644 (file)
@@ -1017,9 +1017,15 @@ gtk_file_chooser_impl_default_set_property (GObject         *object,
          {
            impl->folder_mode = folder_mode;
            if (impl->folder_mode)
-             gtk_widget_hide (impl->list_scrollwin);
+             {
+               gtk_widget_hide (impl->list_scrollwin);
+               gtk_widget_show (impl->tree_scrollwin);
+             }
            else
-             gtk_widget_show (impl->list_scrollwin);
+             {
+               gtk_widget_hide (impl->tree_scrollwin);
+               gtk_widget_show (impl->list_scrollwin);
+             }
          }
       }
       break;
@@ -1342,32 +1348,30 @@ update_chooser_entry (GtkFileChooserImplDefault *impl)
 static void
 check_bookmarks_sensitivity (GtkFileChooserImplDefault *impl)
 {
-  GtkTreeIter *iter;
+  GtkTreeIter iter;
   gboolean exists;
 
   if (!gtk_file_system_get_supports_bookmarks (impl->file_system))
     return;
 
-  iter = gtk_tree_iter_copy (&impl->bookmarks_iter);
-
   exists = FALSE;
 
-  while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), iter))
-    {
-      GtkFilePath *path;
+  if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (impl->shortcuts_model), &iter))
+    do
+      {
+       GtkFilePath *path;
 
-      gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), iter, SHORTCUTS_COL_PATH, &path, -1);
-      g_assert (path != NULL);
+       gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter, SHORTCUTS_COL_PATH, &path, -1);
 
-      if (gtk_file_path_compare (path, impl->current_folder) == 0)
-       {
-         exists = TRUE;
-         break;
-       }
-    }
+       if (path && gtk_file_path_compare (path, impl->current_folder) == 0)
+         {
+           exists = TRUE;
+           break;
+         }
+      }
+    while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter));
 
   gtk_widget_set_sensitive (impl->add_bookmark_button, !exists);
-  gtk_tree_iter_free (iter);
 }
 
 static void